<?php

// +---------------------------------------------+
// |     Copyright  2010 - 2018 InterPhoto       |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

include('includes/Admin.Core.php');

// ############################ SETUP PAGE CHARSET #############################

function StartMenu()
{
	echo '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td bgcolor="#FFFFFF" style="padding-left: 2px; padding-top: 2px; padding-right: 2px; padding-bottom: 0px;">';
}


function PrintMenuTitle($name, $open)
{
	echo '<div class="menutitle" onclick="ToggleDiv(\'' . $name . '\');"><img id="img_' . $name . '" src="' . TEMPLATEPATH . 'images/'. Iif($open, 'closed.gif', 'open.gif') . '" border="0" align="absmiddle">&nbsp;&nbsp;' . $name . '</div><div id="div_' . $name . '" style="display:' . Iif($open, 'block', 'none') . ';">';
}

function PrintMenuRow($url, $name)
{
	echo '<div class="menulink-normal" onclick="nav_goto(\'' . $url . '\');" onmouseover="this.className=\'menulink-hover\';" onmouseout="this.className=\'menulink-normal\'"><img src="' . TEMPLATEPATH . 'images/menu_1.gif" border="0" align="absmiddle">&nbsp;<a href="' . $url . '" target="mainFrame">' . $name . '</a></div>';
}


function EndBlock()
{
	echo '</div>';
}


function EndMenu()
{
	echo '</td>
	</tr>
	</table>
	<div style="margin-bottom:24px"></div>';
}

?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<?php echo TEMPLATEPATH; ?>menu.css" />
<script type="text/javascript">
if(top.location == self.location)
{
	self.location.replace("index.php")
}

function ToggleDiv(className)
{
	var img = document.getElementById('img_' + className);
	var div = document.getElementById('div_' + className);

	if(div.style.display == 'none')
	{
		img.src = '<?php echo TEMPLATEPATH; ?>images/closed.gif';
		div.style.display = 'block';
	}
	else
	{
		img.src = '<?php echo TEMPLATEPATH; ?>images/open.gif';
		div.style.display = 'none';
	}
}

function nav_goto(targeturl)
{
	parent.frames.mainFrame.location = targeturl;
}
</script>
</head>
<body>

<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="center"><a href="admin.home.php" target="mainFrame" class="normal" onfocus="this.blur()" title="后台首页"><img src="<?php echo TEMPLATEPATH; ?>images/logo.gif" border="0" /></a></td>
</tr>
<tr>
<td align="center" style="padding-top: 8px; padding-bottom: 12px;">
<a href="admin.home.php" target="mainFrame" class="normal">后台首页</a>&nbsp;|&nbsp;
<a href="../" target="_blank" class="normal" />网站</a>&nbsp;|&nbsp;

<?php
echo '<a href="index.php?logout=1" class="normal" target="_parent" onclick="return confirm(\'确定退出InterPhoto图片网站管理系统吗?\');"><img src="' . TEMPLATEPATH . 'images/logout.gif" border="0" /> 退出</a>';
?>
</td>
</tr>
</table>

<table width="150" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td valign="top" align="center">

<?php

// admin menus
if($userinfo['manage'])
{
	// ########################## Menu_Settings  ##########################

	StartMenu();
	PrintMenuTitle('系统管理', true);
	if($userinfo['managesetting']) PrintMenuRow('admin.mainsettings.php', '基本设置');
	if($userinfo['managelanguage']) PrintMenuRow('admin.languages.php', '语言管理');
	if($userinfo['managetemplate']) PrintMenuRow('admin.templates.php', '模板管理');
	if($userinfo['managedatabase']) PrintMenuRow('admin.database.php', '数据维护');
	if($userinfo['manage']) PrintMenuRow('admin.phpinfo.php', '环境信息');
	if($userinfo['manageupgrade']) PrintMenuRow('admin.upgrade.php', '系统升级');
	EndBlock();
	EndMenu();

	// ########################## Menu_Users  ##########################
	if($userinfo['manageusergroup'] OR $userinfo['manageuser'])
	{
		StartMenu();
		PrintMenuTitle('用户管理', true);
		if($userinfo['manageuser']) PrintMenuRow('admin.users.php?action=adduser', '添加用户');
		if($userinfo['manageuser']) PrintMenuRow('admin.users.php', '管理用户');
		if($userinfo['manageusergroup']) PrintMenuRow('admin.usergroups.php', '用户群组');
		EndBlock();
		EndMenu();
	}

	// ########################## Menu_Images  ##########################
	if($userinfo['managecategory'] OR $userinfo['manageimage'] OR $userinfo['managecomment'])
	{
		StartMenu();
		PrintMenuTitle('图片管理', true);
		if($userinfo['managecategory']) PrintMenuRow('admin.icategories.php', '分类目录');
		if($userinfo['manageimage']) PrintMenuRow('admin.images.php', '管理图片');
		if($userinfo['managecomment']) PrintMenuRow('admin.comments.php', '管理评论');
		EndBlock();
		EndMenu();
	}

	// ########################## Menu_Content  ##########################
	if($userinfo['managenews'])
	{
		StartMenu();
		PrintMenuTitle('文章管理', true);
		PrintMenuRow('admin.news.php', '新闻管理');
		PrintMenuRow('admin.contents.php', '常态内容');
		EndBlock();
		EndMenu();
	}

}

?>

</td>
</tr>
</table>
</body>
</html>